<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script>
   window.onload=function(){
       document.getElementById('btn').onclick=function(){
         var bookvalue=document.getElementById('book').value;
         var xhr=new XMLHttpRequest();
         xhr.open('get','./ajax图书.php?bookvalue='+bookvalue);
         xhr.send();
         xhr.onreadystatechange = function() {
                if (xhr.readyState == 4) {
                    if (xhr.status == 200) {
                        var span = document.getElementById('info');
                        span.innerHTML = xhr.responseText;
                    }
                }
            }
        
       }
   }
</script>
<body>
    <form action="">
        请输入要查询的图书:<input type="text" id="book">
        <span id="info"></span>
        <input type="button" name="" value="注册" id="btn">
    </form>
</body>
</html>